package vn.com.vega.music.objects;

import vn.com.vega.music.utils.Util;
import android.os.Parcel;
import android.os.Parcelable;

public class Video implements Parcelable {

	public String id;
	public String title = "";
	public String thumbnail_large = "";
	public String thumbnail_small = "";
	public int duration;

	// chacha client
	public int viewCount = 0;
	public String price; // Only for cha cha 1.x version
	public String listenPrice = "";
	public String downloadPrice;
	public String artistName;
	public boolean isLocal;
	public String cached_file_path = "";
	public String shareMessage;
	public boolean isFavorite = false;

	public Video(boolean local) {
		isLocal = local;
	}

	public Video() {
		isLocal = false;
	}

	public boolean isDownloaded() {
		if (isLocal) {
			return false;
		}
		if (!Util.checkStringIsemptyOrNull(cached_file_path)) {
			return true;
		}
		return false;
	}
	
	public boolean islocal() {
		// is video exist on device, not download by ChaCha
		return isLocal;
	}

	/**
	 * Implement for pass object via aidl
	 */

	public void writeToParcel(Parcel out) {
		out.writeString(id);
		out.writeString(title);
		out.writeString(thumbnail_small);
		out.writeString(thumbnail_large);
		out.writeInt(duration);
		out.writeInt(viewCount);
		out.writeString(price);
		out.writeString(artistName);
		out.writeString(cached_file_path);
		out.writeString(shareMessage);
	}

	public void readFromParcel(Parcel in) {
		id = in.readString();
		title = in.readString();
		thumbnail_small = in.readString();
		thumbnail_large = in.readString();
		duration = in.readInt();
		viewCount = in.readInt();
		price = in.readString();
		artistName = in.readString();
		cached_file_path = in.readString();
		shareMessage = in.readString();
	}

	public Video(Parcel par) {
		readFromParcel(par);
	}
	

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		// TODO Auto-generated method stub
		writeToParcel(dest);
	}

	public static final Parcelable.Creator<Video> CREATOR = new Parcelable.Creator<Video>() {

		@Override
		public Video createFromParcel(Parcel source) {
			// TODO Auto-generated method stub
			return new Video(source);
		}

		@Override
		public Video[] newArray(int size) {
			// TODO Auto-generated method stub
			return new Video[size];
		}

	};

	/**
	 * End implement for pass object via aidl
	 */

}
